package cn.abellflower.flowerhomehandler.home.enums;

/**
 * @Description
 * @Author gbzdyf@126.com
 * @Date 2020/10/25 10:07 下午
 */
public class ScanEnum {

    /***
     * 扫码类型枚举
     */
    public static enum ScanTypeEnum {
        /**
         * 扫码类型枚举
         */
        PAY_K_SCAN("PKS_API", "支付即开扫码"),
        KOU_BEI_K_SCAN("KOU_BEI_API", "口碑扫码"),
        IG_PAY_K_SCAN("IG_PAY_API", "聚合支付"),
        QY_K_SCAN("QY_API", "企业扫码[API对接获取订单]"),
        QY_SIMPLE_K_SCAN("QY_ORDER", "企业离线扫码[WEB]"),
        QRC_SIMPLE_K_SCAN("QRC_ORDER", "二维码扫码[订单信息放入二维码]"),
        STATIC_CODE_K_SCAN("STATIC_ORDER", "静态码扫码[订单信息放入二维码]"),
        ISV_SIMPLE_K_SCAN("ISV_SIMPLE_API", "ISV一订单一销方[对接开放平台]"),
        ISV_MULTI_K_SCAN("ISV_MULTI_API", "ISV一订单多销方[对接开放平台]"),
        TAXI_K_SCAN("TAXI_ORDER", "出租车扫码[]");

        /**
         * 扫码类型 [标识不同扫码来源 与 使用场景]
         */
        private final String scanTypeSrc;

        /**
         * 扫码类型描述
         */
        private final String description;

        ScanTypeEnum(String scanTypeSrc, String description) {
            this.scanTypeSrc = scanTypeSrc;
            this.description = description;
        }

        public String getScanTypeSrc() {
            return scanTypeSrc;
        }

        public String getDescription() {
            return description;
        }
    }


    /***
     * 扫码路由前端视图
     */
    public static enum ScanRouteViewEnum {

        /**
         * 前端视图
         */
        ERROR_ROUTE_VIEW("ERROR_VIEW","/error", "错误页面视图"),
        INDEX_ROUTE_VIEW("INDEX_VIEW","/?paramList=%s", "填开页面视图"),
        ORDER_ROUTE_VIEW("MAKE_INVOICE_VIEW","/makeInvoice?paramList=%s", "发票填开路由视图"),
        VALID_CODE_ROUTE_VIEW("VALID_CODE_VIEW","/vcode?paramList=%s", "验证码路由视图"),
        VALID_BUYER_NAME_ROUTE_VIEW("VALID_BUYER_NAME_VIEW","/buyerNameValid?paramList=%s", "抬头验证路由视图"),
        INVOICE_LIST_ROUTE_VIEW("INVOICE_LIST_VIEW","/mutilSale?paramList=%s", "发票列表路由视图"),
        INVOICE_STATUS_ROUTE_VIEW("INVOICE_STATUS_VIEW","/InvoiceStatus?paramList=%s", "发票状态路由视图"),
        INVOICE_TEMPLATE_ROUTE_VIEW("INVOICE_TEMPLATE_VIEW","/invoiceShow?paramList=%s", "图片|文字模版路由视图"),
        PRINT_QRCODE("PRINT_QRCODE","/printQrcode?paramList=%s", "打印二维码扫码跳转中转视图"),
        ORDERNOVALID_ROUTE_VIEW("ORDERNOVALID_VIEW","/orderNoValid?appKey=%s&jskpCode=%s", "离线扫码和天下第一泉");
        /**
         * 扫码路由前端视图
         */
        private final String routeView;

        /**
         * 扫码前端视图页面
         */
        private final String pageView;

        /**
         * 描述信息
         */
        private final String description;

        ScanRouteViewEnum(String routeView, String pageView, String description) {
            this.routeView = routeView;
            this.pageView = pageView;
            this.description = description;
        }

        public String getRouteView() {
            return routeView;
        }

        public String getDescription() {
            return description;
        }

        public String getPageView() {
            return pageView;
        }
    }

    /***
     * 扫码背景色
     */
    public static enum ScanBgColorViewEnum {

        /**
         * 背景色调 0 蓝色  1 橙色  2 灰色
         */
        BG_BLUE_COLOR_VIEW(0, "蓝色"),
        BG_ORANGE_COLOR_VIEW(1, "橙色"),
        BG_GRAY_COLOR_VIEW(2, "灰色");

        /**
         * 扫码路由前端视图
         */
        private final int bgColor;

        /**
         * 描述信息
         */
        private final String description;

        ScanBgColorViewEnum(int bgColor, String description) {
            this.bgColor = bgColor;
            this.description = description;
        }

        public int getBgColor() {
            return bgColor;
        }

        /**
         * 转换背景色
         * @param color 背景色调 0 蓝色  1 橙色  2 灰色
         * @return ScanBgColorViewEnum
         */
        public static ScanBgColorViewEnum tranBgColor(int color) {
            switch (color) {
                case 0:
                    return ScanBgColorViewEnum.BG_BLUE_COLOR_VIEW;
                case 1:
                    return ScanBgColorViewEnum.BG_ORANGE_COLOR_VIEW;
                case 2:
                    return ScanBgColorViewEnum.BG_GRAY_COLOR_VIEW;
                default:
                    return ScanBgColorViewEnum.BG_BLUE_COLOR_VIEW;
            }
        }
    }
}
